package com.treasure.mall.biz.service.core.order;

import com.treasure.mall.biz.base.SearchableCrudService;
import com.treasure.mall.biz.base.UserDetails;
import com.treasure.mall.biz.dto.condition.OrderSearchCondition;
import com.treasure.mall.biz.dto.order.DeliverDTO;
import com.treasure.mall.biz.entity.order.SubOrderPO;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/6/11
 */
public interface SubOrderService extends SearchableCrudService<SubOrderPO, String> {
    /**
     * 订单发货
     *
     * @param deliverDTO
     * @param userDetails 发货人
     */
    @Transactional
    void deliver(DeliverDTO deliverDTO, UserDetails userDetails);

    /**
     * 签收
     */
    void receive(String subOrderId);

    void receive(SubOrderPO subOrderPO);

    List<SubOrderPO> findByOrder(String dealOrderId);

    /**
     * 按条件导出
     *
     * @param beginPage
     * @param pageCount
     * @param condition
     * @return
     */
    HSSFWorkbook export(int beginPage, int pageCount, OrderSearchCondition condition);

    /**
     * 佣金转正/货款结算
     *
     * @param subOrderId
     */
    @Transactional
    void convert(String subOrderId);
}
